#! /usr/bin/python
#coding: utf-8

from MorphologicalRepresentation import *

class ProjectionOfVerbalPrepositionalFramesDicEntry:
    def __init__(self, nb, semsit, fm, refl, vc, sprep, grc, str, trole, expl):
        self.nb = nb
        self.semsit = semsit
        self.fm = fm
        self.refl = refl
        self.vc = vc
        self.sprep = sprep
        self.grc = grc
        self.str = str
        self.trole = trole
        self.expl = expl

class ProjectionOfVerbalPrepositionalFramesDic:
    """
         ProjectionOfVerbalPrepositionalFramesDic represents projection of VPF on the input text T:

     """

    def __init__(self, rc, ldb):
        self._rc = rc
        self._lsd = ldb.get_lsd()
        self._dvpf = ldb.get_dvpf()
        self._build()

    def _build(self):
        self._arvfr = []
        for r in range(self._rc.get_rows_num()):
            rc_r = self._rc.get_row(r)
            if rc_r.unit[0] in ',. ?;:"{}[]' or POS_TAGS.VERB not in rc_r.tclass:
                continue

            ls = self._lsd.get_sems_by_word(rc_r.unit[0])
            for a in ls:
                #print a
                frames = self._dvpf.get_frames_by_semsit(a[3])
                for s in frames:
                    self._arvfr.append(ProjectionOfVerbalPrepositionalFramesDicEntry(r,s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9]))

    def get_array(self):
        return self._arvfr
